﻿Imports System.Text

Namespace Cartes.MatieresPremieres

    Public MustInherit Class CarteMatierePremiere
        Implements Carte

#Region "Implementations"
        Public ReadOnly Property Couleur As Carte.TypeCouleur Implements Carte.Couleur
            Get
                Return Carte.TypeCouleur.Marron
            End Get
        End Property

        Public ReadOnly Property Description As String Implements Carte.Description
            Get
                Return "Ce bâtiment produit de(s) ressource(s)"
            End Get
        End Property

        Private _effet As New List(Of List(Of Carte.TypeRessouce))
        Public Property Effet As List(Of List(Of Carte.TypeRessouce)) Implements Carte.Effet
            Get
                Return _effet
            End Get
            Protected Set(value As List(Of List(Of Carte.TypeRessouce)))
                _effet = value
            End Set
        End Property

        Public MustOverride ReadOnly Property NomBatiment As String Implements Carte.NomBatiment

        Public MustOverride ReadOnly Property Age As Integer Implements Carte.Age

        Public MustOverride ReadOnly Property FrequenceCarteNombreJoueur As List(Of Integer) Implements Carte.FrequenceCarteNombreJoueur

        Public MustOverride ReadOnly Property CoutRessource As List(Of Carte.TypeRessouce) Implements Carte.CoutRessource

        Public MustOverride ReadOnly Property Gratuite As List(Of Carte) Implements Carte.Gratuite

#End Region

#Region "Overrides"
        Public Overrides Function ToString() As String
            Return String.Format("Batiment: {0} Couleur: {1} Cout: {2} Effet: {3}", NomBatiment.PadRight(25), Couleur.ToString.PadRight(10), String.Join(",", Me.CoutRessource.ToArray).PadRight(20), Me.EffetToString)
        End Function
#End Region

        Public Function EffetToString() As String
            Dim sb As New StringBuilder
            For Each opt As List(Of Carte.TypeRessouce) In Effet
                sb.Append(String.Join(",", opt.ToArray()) + "/")
            Next
            Return sb.ToString.Remove(sb.ToString.Length - 1)
        End Function

    End Class
End Namespace